package com.geeklan.smart.ui.viewmodel.pet;

import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;

import com.geeklan.smart.data.repository.pet.PetRepository;

public class PetViewModelFactory implements ViewModelProvider.Factory {

    private final PetRepository petRepository;

    public PetViewModelFactory(PetRepository petRepository) {
        this.petRepository = petRepository;
    }

    @Override
    public <T extends ViewModel> T create(Class<T> modelClass) {
        if (modelClass.isAssignableFrom(PetViewModel.class)) {
            return (T) new PetViewModel(petRepository);
        }
        throw new IllegalArgumentException("Unknown ViewModel class");
    }
}

